package com.xy.gateway.servlet;

/***********************************************************************
 * Module:  EpayGateResServlet.java
 * Author:  ligh1
 * Purpose: Defines the Class EpayGateResServlet
 ***********************************************************************/

import java.util.Map;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;

import com.xy.gateway.response.ResponseProcessor;

/** @pdOid a60e2258-6068-4f38-9859-5a98b4ceeb97 */
public class EpayGateResServlet extends HttpServlet {
	public static Logger  log= Logger.getLogger(EpayGateResServlet.class);

	@Override
	protected void service(HttpServletRequest req, HttpServletResponse res) {

		ResponseProcessor responseBuilder = new ResponseProcessor();
		try {
			printResponseURL(req);
			responseBuilder.processResponse(req, res);
		} catch (Exception e) {
        log.error("",e);   
		}

	}
	
	private void printResponseURL(HttpServletRequest req){
		String servletPath=req.getServletPath();
		String qString=req.getQueryString();
		log.debug("servletpath:"+servletPath);
		log.debug("queryString:"+qString);
        
        Map<String , String[]> m=req.getParameterMap();
        
       for(String s:m.keySet()){
    	   try {
			log.debug("request parameter key:"+s+" values:"+m.get(s)[0]);
		} catch (Exception e) {
			log.error("",e);
		}
       }
       
	}

}